package network;

import javax.swing.SwingWorker;

import data.ListResponse;


public class ListWorker extends SwingWorker<ListResponse, Object>{

	public enum Type { Products, Objects };
	
	private Type mType;
	
	public ListWorker(Type type) {
		mType = type;
	}
	
	@Override
	protected ListResponse doInBackground() throws Exception {
		ListResponse response = null;
		if (mType == Type.Products) {
			//TODO: iterate
			response = NetworkManager.getInstance().getProductsData();
		} else if (mType == Type.Objects) {
			response = NetworkManager.getInstance().getDepartments();
		}
 		return response;
	}

	@Override
	protected void done() {
		// TODO Auto-generated method stub
		super.done();
	}

}
